<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ConstructorUtils (Apache Commons Lang 3.3.2 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="ConstructorUtils (Apache Commons Lang 3.3.2 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ConstructorUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../org/apache/commons/lang3/reflect/FieldUtils.html" title="class in org.apache.commons.lang3.reflect"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/lang3/reflect/ConstructorUtils.html" target="_top">Frames</a></li>
<li><a href="ConstructorUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.lang3.reflect</div>
<h2 title="Class ConstructorUtils" class="title">Class ConstructorUtils</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.lang3.reflect.ConstructorUtils</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">ConstructorUtils</span>
extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block"><p> Utility reflection methods focused on constructors, modeled after
 <a href="../../../../../org/apache/commons/lang3/reflect/MethodUtils.html" title="class in org.apache.commons.lang3.reflect"><code>MethodUtils</code></a>. </p>

 <h3>Known Limitations</h3> <h4>Accessing Public Constructors In A Default
 Access Superclass</h4> <p>There is an issue when invoking <code>public</code> constructors
 contained in a default access superclass. Reflection correctly locates these
 constructors and assigns them as <code>public</code>. However, an
 <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang"><code>IllegalAccessException</code></a> is thrown if the constructor is
 invoked.</p>

 <p><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html" title="class in org.apache.commons.lang3.reflect"><code>ConstructorUtils</code></a> contains a workaround for this situation: it
 will attempt to call <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/AccessibleObject.html?is-external=true#setAccessible(boolean)" title="class or interface in java.lang.reflect"><code>AccessibleObject.setAccessible(boolean)</code></a> on this constructor. If this
 call succeeds, then the method can be invoked as normal. This call will only
 succeed when the application has sufficient security privileges. If this call
 fails then a warning will be logged and the method may fail.</p></div>
<dl><dt><span class="strong">Since:</span></dt>
  <dd>2.5</dd>
<dt><span class="strong">Version:</span></dt>
  <dd>$Id: ConstructorUtils.java 1559779 2014-01-20 17:19:02Z mbenson $</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#ConstructorUtils()">ConstructorUtils</a></strong>()</code>
<div class="block">ConstructorUtils instances should NOT be constructed in standard
 programming.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#getAccessibleConstructor(java.lang.Class, java.lang.Class...)">getAccessibleConstructor</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                        <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;...&nbsp;parameterTypes)</code>
<div class="block">Finds a constructor given a class and signature, checking accessibility.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#getAccessibleConstructor(java.lang.reflect.Constructor)">getAccessibleConstructor</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;&nbsp;ctor)</code>
<div class="block">Checks if the specified constructor is accessible.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#getMatchingAccessibleConstructor(java.lang.Class, java.lang.Class...)">getMatchingAccessibleConstructor</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                                <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;...&nbsp;parameterTypes)</code>
<div class="block">Finds an accessible constructor with compatible parameters.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#invokeConstructor(java.lang.Class, java.lang.Object...)">invokeConstructor</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                 <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>...&nbsp;args)</code>
<div class="block">Returns a new instance of the specified class inferring the right constructor
 from the types of the arguments.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])">invokeConstructor</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                 <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]&nbsp;args,
                 <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;[]&nbsp;parameterTypes)</code>
<div class="block">Returns a new instance of the specified class choosing the right constructor
 from the list of parameter types.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#invokeExactConstructor(java.lang.Class, java.lang.Object...)">invokeExactConstructor</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                      <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>...&nbsp;args)</code>
<div class="block">Returns a new instance of the specified class inferring the right constructor
 from the types of the arguments.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])">invokeExactConstructor</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                      <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]&nbsp;args,
                      <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;[]&nbsp;parameterTypes)</code>
<div class="block">Returns a new instance of the specified class choosing the right constructor
 from the list of parameter types.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="ConstructorUtils()">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ConstructorUtils</h4>
<pre>public&nbsp;ConstructorUtils()</pre>
<div class="block"><p>ConstructorUtils instances should NOT be constructed in standard
 programming. Instead, the class should be used as
 <code>ConstructorUtils.invokeConstructor(cls, args)</code>.</p>

 <p>This constructor is <code>public</code> to permit tools that require a JavaBean
 instance to operate.</p></div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="invokeConstructor(java.lang.Class, java.lang.Object...)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invokeConstructor</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;invokeConstructor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                      <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>...&nbsp;args)
                           throws <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a>,
                                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a>,
                                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a>,
                                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></pre>
<div class="block"><p>Returns a new instance of the specified class inferring the right constructor
 from the types of the arguments.</p>
 
 <p>This locates and calls a constructor.
 The constructor signature must match the argument types by assignment compatibility.</p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the type to be constructed</dd><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to be constructed, not <code>null</code></dd><dd><code>args</code> - the array of arguments, <code>null</code> treated as empty</dd>
<dt><span class="strong">Returns:</span></dt><dd>new instance of <code>cls</code>, not <code>null</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if <code>cls</code> is <code>null</code></dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a></code> - if a matching constructor cannot be found</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a></code> - if invocation is not permitted by security</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a></code> - if an error occurs on invocation</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></code> - if an error occurs on instantiation</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])"><code>invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])</code></a></dd></dl>
</li>
</ul>
<a name="invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invokeConstructor</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;invokeConstructor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                      <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]&nbsp;args,
                      <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;[]&nbsp;parameterTypes)
                           throws <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a>,
                                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a>,
                                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a>,
                                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></pre>
<div class="block"><p>Returns a new instance of the specified class choosing the right constructor
 from the list of parameter types.</p>
 
 <p>This locates and calls a constructor.
 The constructor signature must match the parameter types by assignment compatibility.</p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the type to be constructed</dd><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to be constructed, not <code>null</code></dd><dd><code>args</code> - the array of arguments, <code>null</code> treated as empty</dd><dd><code>parameterTypes</code> - the array of parameter types, <code>null</code> treated as empty</dd>
<dt><span class="strong">Returns:</span></dt><dd>new instance of <code>cls</code>, not <code>null</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if <code>cls</code> is <code>null</code></dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a></code> - if a matching constructor cannot be found</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a></code> - if invocation is not permitted by security</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a></code> - if an error occurs on invocation</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></code> - if an error occurs on instantiation</dd><dt><span class="strong">See Also:</span></dt><dd><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true#newInstance(java.lang.Object...)" title="class or interface in java.lang.reflect"><code>Constructor.newInstance(java.lang.Object...)</code></a></dd></dl>
</li>
</ul>
<a name="invokeExactConstructor(java.lang.Class, java.lang.Object...)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invokeExactConstructor</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;invokeExactConstructor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                           <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>...&nbsp;args)
                                throws <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a>,
                                       <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a>,
                                       <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a>,
                                       <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></pre>
<div class="block"><p>Returns a new instance of the specified class inferring the right constructor
 from the types of the arguments.</p>

 <p>This locates and calls a constructor.
 The constructor signature must match the argument types exactly.</p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the type to be constructed</dd><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to be constructed, not <code>null</code></dd><dd><code>args</code> - the array of arguments, <code>null</code> treated as empty</dd>
<dt><span class="strong">Returns:</span></dt><dd>new instance of <code>cls</code>, not <code>null</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if <code>cls</code> is <code>null</code></dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a></code> - if a matching constructor cannot be found</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a></code> - if invocation is not permitted by security</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a></code> - if an error occurs on invocation</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></code> - if an error occurs on instantiation</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])"><code>invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])</code></a></dd></dl>
</li>
</ul>
<a name="invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invokeExactConstructor</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;invokeExactConstructor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                           <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]&nbsp;args,
                           <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;[]&nbsp;parameterTypes)
                                throws <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a>,
                                       <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a>,
                                       <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a>,
                                       <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></pre>
<div class="block"><p>Returns a new instance of the specified class choosing the right constructor
 from the list of parameter types.</p>

 <p>This locates and calls a constructor.
 The constructor signature must match the parameter types exactly.</p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the type to be constructed</dd><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to be constructed, not <code>null</code></dd><dd><code>args</code> - the array of arguments, <code>null</code> treated as empty</dd><dd><code>parameterTypes</code> - the array of parameter types, <code>null</code> treated as empty</dd>
<dt><span class="strong">Returns:</span></dt><dd>new instance of <code>cls</code>, not <code>null</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if <code>cls</code> is <code>null</code></dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NoSuchMethodException.html?is-external=true" title="class or interface in java.lang">NoSuchMethodException</a></code> - if a matching constructor cannot be found</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalAccessException.html?is-external=true" title="class or interface in java.lang">IllegalAccessException</a></code> - if invocation is not permitted by security</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect">InvocationTargetException</a></code> - if an error occurs on invocation</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InstantiationException.html?is-external=true" title="class or interface in java.lang">InstantiationException</a></code> - if an error occurs on instantiation</dd><dt><span class="strong">See Also:</span></dt><dd><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true#newInstance(java.lang.Object...)" title="class or interface in java.lang.reflect"><code>Constructor.newInstance(java.lang.Object...)</code></a></dd></dl>
</li>
</ul>
<a name="getAccessibleConstructor(java.lang.Class, java.lang.Class...)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAccessibleConstructor</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;&nbsp;getAccessibleConstructor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                                          <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;...&nbsp;parameterTypes)</pre>
<div class="block"><p>Finds a constructor given a class and signature, checking accessibility.</p>
 
 <p>This finds the constructor and ensures that it is accessible.
 The constructor signature must match the parameter types exactly.</p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the constructor type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to find a constructor for, not <code>null</code></dd><dd><code>parameterTypes</code> - the array of parameter types, <code>null</code> treated as empty</dd>
<dt><span class="strong">Returns:</span></dt><dd>the constructor, <code>null</code> if no matching accessible constructor found</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if <code>cls</code> is <code>null</code></dd><dt><span class="strong">See Also:</span></dt><dd><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true#getConstructor(java.lang.Class...)" title="class or interface in java.lang"><code>Class.getConstructor(java.lang.Class&lt;?&gt;...)</code></a>, 
<a href="../../../../../org/apache/commons/lang3/reflect/ConstructorUtils.html#getAccessibleConstructor(java.lang.reflect.Constructor)"><code>getAccessibleConstructor(java.lang.reflect.Constructor)</code></a></dd></dl>
</li>
</ul>
<a name="getAccessibleConstructor(java.lang.reflect.Constructor)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAccessibleConstructor</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;&nbsp;getAccessibleConstructor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;&nbsp;ctor)</pre>
<div class="block"><p>Checks if the specified constructor is accessible.</p>
 
 <p>This simply ensures that the constructor is accessible.</p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the constructor type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>ctor</code> - the prototype constructor object, not <code>null</code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the constructor, <code>null</code> if no matching accessible constructor found</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if <code>ctor</code> is <code>null</code></dd><dt><span class="strong">See Also:</span></dt><dd><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/SecurityManager.html?is-external=true" title="class or interface in java.lang"><code>SecurityManager</code></a></dd></dl>
</li>
</ul>
<a name="getMatchingAccessibleConstructor(java.lang.Class, java.lang.Class...)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getMatchingAccessibleConstructor</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Constructor.html?is-external=true" title="class or interface in java.lang.reflect">Constructor</a>&lt;T&gt;&nbsp;getMatchingAccessibleConstructor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;T&gt;&nbsp;cls,
                                                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;...&nbsp;parameterTypes)</pre>
<div class="block"><p>Finds an accessible constructor with compatible parameters.</p>
 
 <p>This checks all the constructor and finds one with compatible parameters
 This requires that every parameter is assignable from the given parameter types.
 This is a more flexible search than the normal exact matching algorithm.</p>

 <p>First it checks if there is a constructor matching the exact signature.
 If not then all the constructors of the class are checked to see if their
 signatures are assignment-compatible with the parameter types.
 The first assignment-compatible matching constructor is returned.</p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the constructor type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to find a constructor for, not <code>null</code></dd><dd><code>parameterTypes</code> - find method with compatible parameters</dd>
<dt><span class="strong">Returns:</span></dt><dd>the constructor, null if no matching accessible constructor found</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if <code>cls</code> is <code>null</code></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ConstructorUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../org/apache/commons/lang3/reflect/FieldUtils.html" title="class in org.apache.commons.lang3.reflect"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/lang3/reflect/ConstructorUtils.html" target="_top">Frames</a></li>
<li><a href="ConstructorUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
